package user

import (
	"ginweb/model/token"
	"ginweb/port/userapi"
	"github.com/gin-gonic/gin"
)

func UserLoad(g *gin.Engine) {
	g.GET("/register", userapi.RegisterHtml)
	g.POST("/register", userapi.Register)
	//g.GET("/login", userapi.LoginHtml)
	g.POST("/login", userapi.Login, token.AuthMiddleware())
	userv1 := g.Group("user/v1")
	userv1.Use(token.AuthToken)
	{
		userv1.GET("/:admin", userapi.AdminHtml)
		userv1.POST("/comment", userapi.Comment)
	}
	// 搜索接口
	g.GET("/search", userapi.SearchKeywords)
}
